home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sun4c / archive / tcltk.z / tcltk / slib / tk / demos / mkBitmaps.tcl < prev    next >
Text File  |  1994-09-20  |  1KB  |  47 lines

  1. # mkBitmaps w
  2. #
  3. # Create a top-level window that displays all of Tk's built-in bitmaps.
  4. #
  5. # Arguments:
  6. #    w -    Name to use for new top-level window.
  7.  
  8. proc mkBitmaps {{w .bitmaps}} {
  9.     global tk_library
  10.     catch {destroy $w}
  11.     toplevel $w
  12.     dpos $w
  13.     wm title $w "Bitmap Demonstration"
  14.     wm iconname $w "Bitmaps"
  15.     message $w.msg -font -Adobe-times-medium-r-normal--*-180* -width 4i \
  16.         -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts.  Click the \"OK\" button when you've seen enough."
  17.     frame $w.frame
  18.     bitmapRow $w.frame.0 error gray25 gray50 hourglass
  19.     bitmapRow $w.frame.1 info question questhead warning
  20.     button $w.ok -text OK -command "destroy $w"
  21.     pack $w.msg -side top -anchor center
  22.     pack $w.frame -side top -expand yes -fill both
  23.     pack $w.ok -side bottom -fill both
  24. }
  25.  
  26. # The procedure below creates a new row of bitmaps in a window.  Its
  27. # arguments are:
  28. #
  29. # w -        The window that is to contain the row.
  30. # args -    The names of one or more bitmaps, which will be displayed
  31. #        in a new row across the bottom of w along with their
  32. #        names.
  33.  
  34. proc bitmapRow {w args} {
  35.     frame $w
  36.     pack $w -side top -fill both
  37.     set i 0
  38.     foreach bitmap $args {
  39.     frame $w.$i
  40.     pack $w.$i -side left -fill both -pady .25c -padx .25c
  41.     label $w.$i.bitmap -bitmap $bitmap
  42.     label $w.$i.label -text $bitmap -width 9
  43.     pack $w.$i.label $w.$i.bitmap -side bottom
  44.     incr i
  45.     }
  46. }
  47.